/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package filmlibrary.web;

import filmlibrary.orm.ORMHelper;
import filmlibrary.orm.classes.Groups;
import filmlibrary.orm.classes.Users;
import java.util.List;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author karol
 */
@ManagedBean
@RequestScoped
public class UsersBean implements java.io.Serializable {

    private static final Logger logger = Logger.getLogger("filmlibrary.web.UsersBean");
    private ORMHelper orm = new ORMHelper();
    private List<Users> users = null;
    private List<String> group = null;
    private List<Boolean> isAdmin;

    /** Creates a new instance of usersBean */
    public UsersBean() {
        logger.info("konstruktor UsersBean");
        users = getUsersFromDB();
    }

    public String delete(int id) {
        orm.deleteUser(id);
        return "users.xhtml?faces-redirect=true";


    }

    private List<Users> getUsersFromDB() {

        List<Users> lu = orm.getUsers2();


        return lu;


    }

    public List<Users> getUsers() {
        return users;

    }
}
